package legumes.client.ui.basket.grids;

import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceBooleanField;
import com.smartgwt.client.data.fields.DataSourceEnumField;
import com.smartgwt.client.data.fields.DataSourceFloatField;
import com.smartgwt.client.data.fields.DataSourceTextField;

public class BasketDS extends DataSource {

//	private static BasketDS instance = null;  
//	  
//    public static BasketDS getInstance() {  
//        if (instance == null) {  
//            instance = new BasketDS("basketDS");  
//        }  
//        return instance;  
//    }
    
    public BasketDS(String id) {  
    	super();
        setID(id);  
//        setRecordXPath("/List/country");  
//        DataSourceIntegerField pkField = new DataSourceIntegerField("pk");  
//        pkField.setHidden(true);  
//        pkField.setPrimaryKey(true);  
  
        DataSourceTextField libelleField = new DataSourceTextField("libelle", "Lib&eacute;ll&eacute;");  
        libelleField.setPrimaryKey(true);
        
        DataSourceBooleanField isSelectedField = new DataSourceBooleanField("isSelected");  
        DataSourceEnumField catField = new DataSourceEnumField("categorie", "Cat&eacute;gorie");
        catField.setValueMap("F", "L");
        
        DataSourceFloatField prixField = new DataSourceFloatField("prix", "Prix");
        
//        continentField.setValueMap("Europe", "Asia", "North America", "Australia/Oceania", "South America", "Africa");  
        DataSourceFloatField quantiteField = new DataSourceFloatField("quantite", "Quantite"); 
        DataSourceTextField quantiteUnitField = new DataSourceTextField("quantiteUnit", "Unit&eacute;");  
        DataSourceTextField unitField = new DataSourceTextField("unit", "Unit&eacute;");  
        
        
//        DataSourceIntegerField populationField = new DataSourceIntegerField("population", "Population");  
        setFields(libelleField, isSelectedField, catField, unitField, prixField, quantiteField, quantiteUnitField);  
  
//        setDataURL("testData/legumesData.xml");  
        setClientOnly(true);  
    }  
}
